/**
 * @summary 文章模块
 * @author 志鹏
 * @summary ...
 */
import * as articleApi from '@/api/article'

export default {
  namespaced: true,
  state: {
    // 文章列表
    articleList: [],
    articlesList: [],
  },
  mutations: {
    SET_ARTICLE_LIST(state, newValue) {
      state.articleList = newValue
    },
    SET_ARTICLES_LIST(state, newValue) {
      state.articlesList = newValue
    }
  },
  actions: {
    async updateArticleList({ commit }, id) {
      const res = await articleApi.getArticleList(id)
      commit('SET_ARTICLE_LIST', res)
    },
    async updateArticlesList({ commit }, id) {
      const res = await articleApi.getArticles(id)
      commit('SET_ARTICLES_LIST', res)
    },
  }
}
